package com.hp.modules.sys.entity;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.hp.common.annotation.DictEnum;
import com.hp.common.base.CodedEnum;
import com.hp.common.base.YesNoEnum;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.Id;
import java.io.Serializable;
import java.util.Date;

/**
 * @Author: mcfan
 * @Description: TODO
 * @Date: 2021/7/28 9:20
 */
public class SysUser implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = -1L;

    @Id
    @ApiModelProperty(value = "主键")
    private Long id;
    @ApiModelProperty(value = "用户名")
    private String userName;

    private String realName;

    private String avatar;

    private String email;

    private String mobilePhone;

    private String telephone;

    private String password;

    private String salt;

    private SexEnum sex;

    private YesNoEnum isLocked;

    private Long deptId;

    private Long postId;

    private String remark;

    private Date createTime;

    private Date updateTime;

    private YesNoEnum isDeleted;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMobilePhone() {
        return mobilePhone;
    }

    public void setMobilePhone(String mobilePhone) {
        this.mobilePhone = mobilePhone;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public SexEnum getSex() {
        return sex;
    }

    public void setSex(SexEnum sex) {
        this.sex = sex;
    }

    public YesNoEnum getIsLocked() {
        return isLocked;
    }

    public void setIsLocked(YesNoEnum isLocked) {
        this.isLocked = isLocked;
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    public Long getPostId() {
        return postId;
    }

    public void setPostId(Long postId) {
        this.postId = postId;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public YesNoEnum getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(YesNoEnum isDeleted) {
        this.isDeleted = isDeleted;
    }

    @DictEnum(key = "sys_user_sex",name = "性别")
    public enum SexEnum implements CodedEnum{
        /**
         * 男
         */
        MALE(1,"男"),
        /**
         * 女
         */
        FEMALE(2,"女"),
        /**
         * 未知
         */
        UNKNOWN(3,"未知");

        private int value;

        private String name;

        @JsonCreator
        public static SexEnum forValue(int value){
            return CodedEnum.codeOf(SexEnum.class,value).get();
        }

        SexEnum(int value, String name) {
            this.value = value;
            this.name = name;
        }

        @JsonValue
        public int getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }
}
